import javax.swing.*; import java.awt.*; public class myFrame extends JFrame { JLabel labelHeader = new JLabel("Database Browser",JLabel.CENTER ); JLabel labelName = new JLabel( "Name" ); JLabel labelAddress = new JLabel( "Address" ); JLabel labelCity = new JLabel( "City" ); JLabel labelState = new JLabel( "State" ); JLabel labelZip = new JLabel( "Zip" ); JButton buttonPrev = new JButton( "Previous" ); JButton buttonReset = new JButton( "Reset" ); JButton buttonNext = new JButton( "Next" ); JTextField textFieldName = new JTextField(); JTextField textFieldAddress = new JTextField(); JTextField textFieldCity = new JTextField(); JTextField textFieldState = new JTextField(); JTextField textFieldZip = new JTextField(); public myFrame(String title) { super( title ); setDefaultCloseOperation( DO_NOTHING_ON_CLOSE ); JPanel cpBig= new JPanel(); JPanel cpLeft= new JPanel(); JPanel cpRight= new JPanel(); JPanel cpBottom= new JPanel(); JPanel cpTop= new JPanel(); getContentPane().add( cpBig ); cpBig.setLayout( new BorderLayout() ); cpBig.add( cpLeft, BorderLayout.WEST ); cpBig.add( cpRight, BorderLayout.CENTER ); cpBig.add( cpBottom, BorderLayout.SOUTH ); cpBig.add( cpTop, BorderLayout.NORTH ); cpLeft.setLayout( new GridLayout(5,1) ); cpRight.setLayout( new GridLayout(5,1) ); cpBottom.setLayout( new GridLayout(1,3) ); labelHeader.setFont( new Font("TimesRoman",Font.BOLD,24 ) ); cpTop.add( labelHeader ); //labelHeader.setBounds( 40,10,300,50 ); cpBottom.add( buttonPrev ); //buttonPrev.setBounds( 30,250,80,25 ); cpLeft.add( labelName ); //labelName.setBounds( 10,80,80,25 ); cpRight.add(textFieldName ); //textFieldName.setBounds( 120,80,250,25 ); addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing( java.awt.event.WindowEvent evt) { shutDown(); } } ); } public void shutDown() { int returnVal=JOptionPane.showConfirmDialog( this, "Are you sure you want to quit?"); if( returnVal==JOptionPane.YES_OPTION) { // close out stuff System.exit(0); } } public static void main(String args[]) { myFrame m1 = new myFrame( "My Database Browser" ); m1.setSize( 400,350 ); m1.show(); } }